# Description: Update window placement
#  If the user hasn't set any position prefs (Top or Left directives), then
#  center the window
# Bug-Debian: http://bugs.debian.org/471319
# Author: Vincent Legout <vincent@legout.info>

Index: gmrun-0.9.2/config/gmrunrc
===================================================================
--- gmrun-0.9.2.orig/config/gmrunrc	2010-02-04 21:55:11.968469321 +0800
+++ gmrun-0.9.2/config/gmrunrc	2010-02-04 21:55:14.860466459 +0800
@@ -9,8 +9,6 @@
 
 # Set window geometry (except height)
 Width = 400
-Top = 100
-Left = 200
 
 # History size
 History = 256
Index: gmrun-0.9.2/src/main.cc
===================================================================
--- gmrun-0.9.2.orig/src/main.cc	2010-02-04 21:55:22.104464288 +0800
+++ gmrun-0.9.2/src/main.cc	2010-02-04 21:56:42.232468582 +0800
@@ -629,8 +629,8 @@
 
   gtk_box_pack_start(GTK_BOX(hbox), compline, TRUE, TRUE, 0);
   
-  int prefs_top = 80;
-  int prefs_left = 100;
+  int prefs_top = -1;
+  int prefs_left = -1;
   configuration.get_int("Top", prefs_top);
   configuration.get_int("Left", prefs_left);  
 
@@ -659,10 +659,14 @@
     geo_parsed = gtk_window_parse_geometry (GTK_WINDOW (win),
 					    geoptr);
   }
-  else
+  else if (prefs_top != -1 && prefs_left != -1)
   {
     gtk_widget_set_uposition(win, prefs_left, prefs_top);
   }
+  else
+  {
+    gtk_window_set_position (GTK_WINDOW (win), GTK_WIN_POS_CENTER);
+  }
 
   gtk_widget_show(win);
 
